<template>
  <div class="good animate__animated animate__fadeInUp animate__faster">
    <div>
      <img :src="selectFood.image_path" alt="" style="width:100%">
      <div class="iconfont icon-chahao2" @click="close"></div>
    </div>
    <div class="content">
      <div class="title">{{selectFood.name}}</div>
      <div class="month"><span>月售{{selectFood.month_sales}}</span><span>好评{{selectFood.satisfy_rate}}%</span></div>
      <div class="price">
        <div style="color:#ec6206;font-size:.4rem;"> ¥{{selectFood.activity.fixed_price}}</div>
        <CartControll :food="selectFood" @decreaseCount="decrease" />
      </div>
      <div class="desc">{{selectFood.description}}</div>
    </div>
  </div>
</template>
<script>
import CartControll from '../../components/shops/CartControll.vue'
export default {
  props: {
    selectFood: Object
  },
  name: 'FoodView',
  data () {
    return {
    }
  },
  created () {
  },
  computed: {
  },
  methods: {
    close () {
      this.$emit('close', false)
    },
    // 计算商品数量
    decrease (e, foodId) {
      if (foodId == this.selectFood.item_id) {
        console.log(this.selectFood.count);
        this.selectFood.count += e
      }
    },
  },
  components: {
    CartControll
  }
}
</script>
<style  scoped>
.good {
  position: fixed;
  height: 100%;
  width: 100%;
  top: 0;
  background-color: rgb(255, 255, 255);
  z-index: 999;
}
.icon-chahao2 {
  position: absolute;
  top: 0.3rem;
  right: 0.3rem;
  font-size: 0.5rem;
  background-color: rgb(206, 203, 203);
  border-radius: 50%;
  padding: 0.1rem;
  color: #fff;
}
.title {
  font-size: 0.45rem;
  font-weight: bold;
}
.content {
  padding: 0.4rem;
}
.month {
  color: rgb(85, 84, 84);
  font-size: 0.2rem;
  margin: 0.3rem 0;
}
.desc {
  color: rgb(85, 84, 84);
  font-size: 0.35rem;
  margin-top: 0.3rem;
  line-height: .4rem;
}
.price {
  display: flex;
  justify-content: space-between;
}
</style>
